package com.xing.educms.controller;


import com.xing.commonutils.R;
import com.xing.educms.entity.CrmBanner;
import com.xing.educms.service.CrmBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author xingfuao
 * @since 2022-03-20
 */
@RestController
@RequestMapping("/educms/bannerfront")
@CrossOrigin //允许跨域
public class BannerFrontController {

    @Autowired
    CrmBannerService bannerService;


    //value：缓存名，key：可选属性
    @Cacheable(value = "banner",key="'selectIndexList'")
    //查询所有banner
    @GetMapping("getAllBanner")
    public R getAllBanner(){
        List<CrmBanner> list=bannerService.selectAllBanner();
        return R.ok().data("list",list);
    }

}

